Introduction of UnityEditor variant of AI GameDebugger#6
Introduction of UnityEditor variant of AI GameDebugger#6SiliconOrchid wants to merge 1 commit intoGameDevEducation:masterfrom
Conversation
|
I'm very much in favour of having an Editor Window option and I'd agree with the concern for multiple registrations. I'll have a look and a think about ways to approach it. I'd lean towards either options within the Game Debugger itself or allowing it to route the information to multiple sources. For the multiple entries that looks less like duplicate entries and instead it showing info for AIs other than the focussed one. Which is intentional but does look confusing with it being shown first and at the same level. I'll see what can be done to improve that as part of the Editor Window changes. |
|
Update comment to mention that, in this prototype PR the agents are listed separately - so this may be a handy way to view everyone in the scene as well as an alternative way to navigate to the debug information more directly. Thinking about this a bit more, an added-bonus could be that, when selecting an agent in this new list, the corresponding GameObject in the hierarchy is selected (the side effect of highlighting that selected agent in the SceneView would be super nice). I guess that having a tickbox [somewhere in the editor window] to enable/disable this hierarchy-auto-selection behaviour, is a usability feature that's probably going to be needed. I was just quickly trying to add a small update to the code in this PR, to include something that looks something along the lines of this non-working pseudocode (complete hack, missing any safety check etc etc): However, I quickly tripped up on a scoping problem: In the case of the demo, BTW, zero expectation on my part to merge this PR, it's just a convenient way to articulate an idea :-D |
|
I should be able to add support to IDebuggableObject to retrieve (possibly optionally) an associated MonoBehaviour/GameObject and that might work to get around the access restriction. And yep I want to keep the PR around as a reminder and reference point till I figure out which way to head with it. That'll probably be post the inclusion of the Behaviour Tree system just in case that modifies the debugger further. |
|
It's not in the repo yet (it'll be part of the behaviour tree system) but I've setup the groundwork for this. I've split out the gameplay debugger into a core that tracks sources and generates the data and the display side. Multiple displays at the same time are supported and kept in sync. So it'll be much easier to add the editor window and support either or both :) |
|
Cool. Things I did (to feed back in as potentially useful ideas):
|


When editing, my preference is to use the SceneView more than GameView (e.g. for visibility of Navmesh, visibility of debug lines, quick camera navigation, etc).
Currently, in order to view the AI GameDebugger information, I need to keep both the GameView open simultaneously with my SceneView in order to view AI debug information - and that causes a screen real-estate issue.
I would prefer to have the same information available as a Unity CustomEditorWindow, meaning I can dock it wherever I'd like.
This PR is a first draft at duplicating your existing functionality (pretty closely) from the existing
GameDebugger.I think there are almost certainly more polished ways to do what I've done, but I thought it might help get a ball rolling.
Concerns:
IGameDebuggeras that seemed to be the intent behind alternative debuggers like this. However this requires us to implementAddSource(...)andRemoveSource(...). This:GOAPBrainBase.GameDebuggerand duplicated again in this new proposedAIDebuggerCustomEditor.Suggestions:
List<IDebuggableObject> Sources = new();(currently found inGameDebugger) represents the "data". This definitely feels like it should continue to be a singleton GO that can be referenced by other pieces of code ... and that this should be the only place whereAddSource(...)etc is used.Note:
I've just adopted the simple stringbuilder approach to building up the debug info. It's fine, it looks the same ;-)
Issues:
This should probably be opened as a separate issue, but I have propagated an existing bug whereby the displayname of an agent is appearing multiple times at the top of the debug information. This varies depending on where the current selection is, within the collection of agents. Only having a single agent will hide this problem.